utils = {};
utils.galleryresize = function (isonload) {
if ($(".photo_gallery_container").length > 0) {
var wgc = 0,
wgi = 0,
ncnt = 0,
nwgi = 0,
nhgi = 0,
sfw = 0,
sfh = 0,
sf = 0;
$(".photo_gallery_container").each(function () {
var mycontainer = $(this);
var $parent = mycontainer.parent();
mycontainer.appendTo("body").css({
height: "0px",
overflow: "hidden"
});
wgc = $parent.width();
wgi = 250;
ncnt = Math.floor(wgc / wgi);
margin = parseInt($(".photo_gallery", mycontainer).css("margin-left"), 10) + parseInt($(".photo_gallery", mycontainer).css("margin-right"), 10);
nwgi = Math.floor(wgc / ncnt) - margin;
$(".photo_gallery", mycontainer).width(nwgi);
$(".photo_gallery", mycontainer).each(function () {
setmarginleft = false;
mygalleryitem = $(this);
if (isonload) {
var obj = $("img", mygalleryitem);
obj.data("width", obj.width()).data("height", obj.height());
}
hic = mygalleryitem.height();
wic = mygalleryitem.width();
hgi = $("img", mygalleryitem).data("height");
wgi = $("img", mygalleryitem).data("width");
sfh = hic / hgi;
sfw = wic / wgi;
if (sfh < sfw) {
sf = sfw;
} else {
sf = sfh;
}
$("img", mygalleryitem).width(wgi * sf).css("max-width", "none");
nwgi = $("img", mygalleryitem).width();
nhgi = $("img", mygalleryitem).height();
if (sfh < sfw) {
margintop = ((nhgi - hic) / 2) * -1;
$("img", mygalleryitem).css("margin-top", margintop).css("margin-left", 0);
} else {
marginleft = ((nwgi - wic) / 2) * -1;
$("img", mygalleryitem).css("margin-top", 0).css("margin-left", marginleft);
}
});
mycontainer.appendTo($parent).css({
height: "auto",
overflow: "visible"
});
});
}
};
utils.mobilemenu = function () {
/* var $mi;
var $topmenu = $("#topMenu");
var $mm = $topmenu.clone().attr("id", "mobileMenu").addClass("submenu0").insertAfter("#cp-mobileTopBar");
$("ul", $mm).each(function () {$(this).hide().addClass("submenu" + $(this).parents("li").length);});*/
jQuery("#mobileMenuButton" ).click(function() {
jQuery("#mobileMenuWrapper").toggleClass('toggleMobileMenu');
jQuery("#mobileMenuButton").toggleClass('closeMenu');
});
/* $("").insertBefore($(".hasvisiblechild > a", $mm)).on("click", function (e) {$(this).siblings("ul").slideToggle();
});*/
$('#mobileMenu li span.mmToggle').click(function() {
$(this).toggleClass("active");
$(this).siblings("ul").slideToggle();
});
// $("#mobileMenu").wrap( "" );
$("#mobileMenu").appendTo("#mobileMenuWrapper");
$('#cp-MobileLSSContainer').appendTo("#mobileMenuWrapper");
// $(".cp-LSwitchSearchContainer").clone().insertAfter("#mobileMenu");
$("").insertBefore("#mobileMenu");
};
utils.sidemenu = function () {
var $mainmenu = $("#mainmenu");
var x = $("li.selected", $mainmenu).parentsUntil( $mainmenu, "li" ).length ? $("li.selected", $mainmenu).parentsUntil( $mainmenu, "li" ) : $("li.selected", $mainmenu);
if (!$(">ul", $(x[x.length - 1])).length) {
x = $mainmenu.clone();$("li", x).first().remove();
}
var y = $("").append($(">ul", $(x[x.length - 1])).html());
$(">li>ul", y).hide();
$("li.selected", y).parentsUntil(y, "ul").show();
$("li.selected>ul", y).show();
$(".SideMenuJS").append(y);
if ($("li.selected", y).is(":hidden")) {
var $tmp = $("li.selected", y).parents("li:first").addClass("selected");
}
};
utils.fancybox = function () {
if ($.fn.fancybox) {
$('.fancybox').fancybox({
openEffect: 'elastic',
closeEffect: 'elastic',
prevEffect: 'fade',
closeBtn: 'false',
nextEffect: 'fade',
autoSize: true,
loop: false,
padding: 10,
helpers: {
title: {
type: 'inside'
},
overlay: {
speedIn: 500,
opacity: 0.50
},
buttons: {},
media: true,
thumbs: {
width: 50,
height: 50
}
}
});
$(".fancybox.iframe").fancybox({
type: 'iframe',
width: '90%',
loop: false,
closeClick: false,
helpers: {
overlay: {
closeClick: false
}
}
});
}
};
utils.revSliderNew = function (){
var options = {
sliderType:"standard",
jsFileLocation:"../../revolution/js/",
sliderLayout:"auto",
dottedOverlay:"none",
delay:9000,
navigation: {
keyboardNavigation:"off",
keyboard_direction: "horizontal",
mouseScrollNavigation:"off",
onHoverStop:"off",
touch:{
touchenabled:"on",
swipe_threshold: 75,
swipe_min_touches: 1,
swipe_direction: "horizontal",
drag_block_vertical: false
}
,
arrows: {
style:"zeus",
enable:true,
hide_onmobile:false,
hide_under:300,
hide_onleave:false,
hide_delay:200,
hide_delay_mobile:1200,
// tmp:'
" ); } }; function InsertSpaceToRow(param){ var range = RTE.Cursor.get_range(); //var selection = range.parentElement().closest('div[class^="row"]'); var selection = range.parentElement().closest('div'); if( jQuery(selection).hasClass('ms-rtestate-write')){ if(param=="up"){ jQuery(selection).before( "
" ); } else{ jQuery(selection).after( "
" ); } } }; function InsertSpaceToCol(){ var range = RTE.Cursor.get_range(); var selection = range.parentElement().closest('span'); jQuery(selection).before( "
" ); }; ColResize = function (param){ var range = RTE.Cursor.get_range(); var selectedRow = range.parentElement().closest('div[class^="row"]'); var selectedCol = range.parentElement().closest('div[class^="col-md-"]'); jQuery(selectedCol).addClass("selectedCol"); var colArr = jQuery(selectedRow).children("div"); var colNumberDec; var colNumberInc; for (var j=0; j
" ); } else{ jQuery(selection).after( "
" ); } } }; function FixWorkspace() { // if you are using a header that is affixed to the top (i.e. SharePoint Ribbon) put the ID or class here to change the workspace height accordingly. // var header = '#myHeader'; var width = $(window).width(); var height; /* if ($(header).length) { height = $(window).height() - $(header).height(); } else { height = $(window).height(); }*/ height = window.innerHeight; $('#s4-workspace').width(width).height(height); }; utils.mainmenu = function () { $("#mainmenu").find(".selected").parentsUntil($(this), "li").addClass("selectedparent"); }; utils.Tabs = function () { $(".tabs-menu a").click(function(event) { event.preventDefault(); $(this).parent().addClass("current"); $(this).parent().siblings().removeClass("current"); var tab = $(this).attr("href"); $(".tab-content").not(tab).css("display", "none"); $(tab).fadeIn(); utils.galleryresize(); }); } utils.ccTabs = function() { $(".ccTabs-menu a").click(function(event) { event.preventDefault(); var $a = $(this); var $li = $a.parent(); var $menu = $a.parents(".ccTabs-menu").first(); var $container = $a.parents(".ccTabs-container").first(); $li.addClass("current"); $li.siblings().removeClass("current"); var tab = $a.attr("href"); $container.find(".tab-content").not(tab).css("display", "none"); $(tab, $container).show(); }); }; utils.accordion = function (){ var acc = document.getElementsByClassName("accordion"); var i; for (i = 0; i < acc.length; i++) { acc[i].onclick = function () { var panel = this.nextElementSibling; $(panel).slideToggle(); this.classList.toggle("active"); } } }; utils.ScrollTop = function () { jQuery('#s4-workspace').scroll(function() { if (jQuery(this).scrollTop() > 250) { jQuery('#scrollup').fadeIn(300); } else { jQuery('#scrollup').fadeOut(300); } }); jQuery('#scrollup').click(function(){ jQuery('#s4-workspace').animate({scrollTop: 0}, 600); return false; }); }; utils.tablestocolsborder = function () { $(".ms-rteTable-cp-responsive").css("border", "#FF0000 1px solid"); }; utils.CheckExternalUrls = function () { var extensions = ["pdf", "docx", "doc", "xlsx", "xls", "zip", "rar", "ppt", "pptx", "pps", "csv"]; $.expr[':'].external = function(obj) { return (extensions.indexOf(obj.href.split('.').pop()) + 1) || (!obj.href.match(/^mailto\:/) && (obj.hostname != location.hostname) && !obj.href.match(/^javascript\:/) && !obj.href.match(/^$/)) }; $('a:external').attr('target', '_blank').addClass("external-link"); }; utils.SaglikKosesi = function () { $(".saglikKosesiWrapper ").click(function() { var $divHeight = $(this).find(".saglikKosesiHeight"); if($(this).hasClass("toggled")) { $(this).animate({"height": "800px"}).removeClass("toggled"); } else { $(this).animate({"height": $divHeight.height()}).addClass("toggled"); } }); }; //following two functions overriding sharepoint functions to disable "allow xxx to run Microsoft Office" function ProcessImn(){} function ProcessImnMarkers(){} $(document).ready(function () { FixWorkspace(); utils.mainmenu(); utils.mobilemenu(); utils.sidemenu(); utils.revSliderNew(); utils.Tabs(); utils.ccTabs(); utils.accordion(); var inDesignMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value; if (inDesignMode !== "1") { $( "table" ).addClass("table"); if (!($("table").parent().hasClass("table-responsive"))){ $( "table" ).wrap( "" ); } console.log("View MODE"); ProcessImn(); ProcessImnMarkers(); }else{ $(".cp-body-wraper").addClass("editmode"); $("#s4-workspace").addClass("editmodeWorkspace"); $("#scrollup").addClass("cp-hidden"); console.log("Edit MODE"); jQuery(".ms-rtestate-write").keydown(function onKeyDown(event) { if (event.keyCode == 90 || event.keyCode == 89) { setTimeout(RowColFunctions, 500); } }); RowColFunctions(); window.setInterval(function(){ RowColFunctions(); }, 2000); } utils.ScrollTop(); utils.CheckExternalUrls(); $("#cp-signIn").appendTo("#cp-signInNew"); utils.iconCopied(); utils.SaglikKosesi(); }); $(window).load(function($) { utils.galleryresize(true); utils.fancybox(); }); $(window).resize(function () { FixWorkspace(); utils.galleryresize(); });